// pages/Allphoto/repair/repair.js
var utils = require("../../../utils/utils.js");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    src:'',
    osrc:'',
    chooseIndex:1,
    title:'修复后',
    showI:true
  },
  btnConfirm(){
    wx.redirectTo({
      url: '../../print/list/list?code=12653870&name=老照片修复&icon=https://mxjprint.oss-cn-beijing.aliyuncs.com/dictionary/2021111712301241712148_oss.png&path=' + escape(this.data.src) + '&pageNum=1&old=1',
    })
  },
  changeIndex(e){
    var that = this;
    var index = e.currentTarget.dataset.index;
    if (index == 0) {
      that.setData({
        showI: false
      })
      var animation = wx.createAnimation({
        duration: 2500,
        timingFunction: 'linear',
        delay: 0
      });
      animation.width(0).step()
      animation.opacity(0).step({
        duration: 1
      })
      that.setData({
        anmite: animation.export(),
      })
      setTimeout(function () {
        that.setData({
          chooseIndex: 1,
          title: '修复后',
          showI: true
        })
      }, 2500)
    }
    if (index == 1) {
      that.setData({
        showI: false
      })
      var animation = wx.createAnimation({
        duration: 3000,
        timingFunction: 'linear',
        delay: 0
      });
      animation.opacity(1).step({
        duration: 1
      })
      animation.width('624rpx').step()
      that.setData({
        anmite: animation.export(),
      })
      setTimeout(function () {
        that.setData({
          chooseIndex: 0,
          title: '修复前',
          showI: true
        })
      }, 2500)
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      src:unescape(options.img),
      osrc:options.oimg
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  }
})